<!DOCTYPE html>
<html lang="en">
<link rel="stylesheet" th:href="@{/assets/fileinput/css/fileinput.min.css}"/>
<link rel="stylesheet" th:href="@{/assets/fileinput/themes/explorer/theme.min.css}"/>
<link th:href="@{/assets/css/bootstrap.min.css}" rel="stylesheet"/>
<link rel="stylesheet" th:href="@{/assets/css/font-awesome.min.css}"/>
<link rel="stylesheet" th:href="@{/assets/css/font-awesome-ie7.min.css}"/>
<link rel="stylesheet" th:href="@{/assets/css/jquery-ui-1.10.3.custom.min.css}"/>
<link rel="stylesheet" th:href="@{/assets/css/colorbox.css}"/>
<link th:href="@{/assets/css/ace.min.css}" rel="stylesheet" type="text/css"/>
<link th:href="@{/assets/css/ace-rtl.min.css}" rel="stylesheet" type="text/css"/>
<link th:href="@{/assets/css/ace-skins.min.css}" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" type="text/css" th:href="@{/My97DatePicker/skin/WdatePicker.css}"/>
<link rel="stylesheet" th:href="@{/assets/css/chosen.css}"/>
<head th:include="fragments/head::header"/>
<style>
    .error {
        color: #F00
    }

    .button_color {
        color: #6fb3e0
    }

    .input-unit {
        width: 65px;
        height: 25px;
        display: block;
        float: left;
        background-color: #abbac3;
        line-height: 25px;
        text-align: center;
    }
</style>
<body>
<div th:include="fragments/top::top"></div>
<div class="main-container" id="main-container">
    <div class="main-container-inner">
        <div th:include="fragments/left::left" class="sidebar" id="sidebar"></div>
        <div class="main-content">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li><i class="icon-home home-icon"></i>首页</li>
                    <li>佣金系统</li>
                    <li>佣金系统编辑</li>
                </ul>
            </div>
            <form method="post" id="edit">
                <div class="panel panel-default">
                    <div class="panel-heading" style="background-color:#6fb3e0"><span
                            style="margin-left:45% ">佣金信息编辑</span></div>

                    <ul class="list-group BasicInformation">
                        <li class="list-group-item">
                            <div class="row">
                                <input id="schoolId" th:value="${schoolId}" type="text" name="schoolId"
                                       style="display: none"/>
                                <input id="studentNo" th:value="${studentNo}" type="text" name="studentNo"
                                       style="display: none"/>
                                <input id="studentId" th:value="${studentId}" type="text" name="studentId"
                                       style="display: none"/>
                                <input id="newResDomain" th:value="${newResDomain}" style="display: none"/>
                                <input id="commissionImageUrl" th:value="${commissionImageUrl}" style="display: none"/>
                                <input type="hidden" name="schoolName" id="schoolName"/>
                                <input type="hidden" name="courseName" id="courseName"/>
                                <input type="hidden" name="majorName" id="majorName"/>
                                <input type="hidden" name="branch" id="branch"/>
                                <input type="hidden" name="visaCommissionId" id="visaCommissionId"
                                       th:value="${commissionSchool.visaCommissionId !=null}?${commissionSchool.visaCommissionId}"/>
                                <input id="agency_no" name="agencyNo" type="hidden" value=""/>
                                <input id="agency_name" name="agencyName" type="hidden" value=""/>
                                <input type="hidden" id="courseProperty" name="courseProperty"/>
                                <input name="offerFile" id="offerFile"
                                       th:value="${commissionSchool.offerFile !=null}?${commissionSchool.offerFile}"
                                       style="display: none"/>
                                <input name="coeFile" id="coeFile"
                                       th:value="${commissionSchool.coeFile !=null}?${commissionSchool.coeFile}"
                                       style="display: none"/>

                                <input name="emailFile" id="emailFile"
                                       th:value="${commissionSchool.emailFile !=null}?${commissionSchool.emailFile}"
                                       style="display: none"/>

                                <div class="input-group col-lg-12" style="padding-bottom: 10px;padding-left:2px">
                                    <div class="input-group col-lg-3">
                                        <span class="input-group-addon">专业类型</span>
                                        <!--<input type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1">-->
                                        <select type="text" class="form-control" aria-describedby="basic-addon1"
                                                name="collegeType" id="collegeType">
                                            <option value="0">请选择</option>
                                            <option th:selected="${commissionSchool!=null}? ${commissionSchool.collegeType=='1'}"
                                                    value="1">主课
                                            </option>
                                            <option th:selected="${commissionSchool!=null}? ${commissionSchool.collegeType=='2'}"
                                                    value="2">语言
                                            </option>
                                            <option th:selected="${commissionSchool!=null}? ${commissionSchool.collegeType=='3'}"
                                                    value="3">预备
                                            </option>
                                            <option th:selected="${commissionSchool!=null}? ${commissionSchool.collegeType=='4'}"
                                                    value="4">快捷
                                            </option>
                                            <option th:selected="${commissionSchool!=null}? ${commissionSchool.collegeType=='5'}"
                                                    value="5">夏校
                                            </option>
                                            <option th:selected="${commissionSchool!=null}? ${commissionSchool.collegeType=='6'}"
                                                    value="6">桥梁
                                            </option>
                                            <option th:selected="${commissionSchool!=null}? ${commissionSchool.collegeType=='7'}"
                                                    value="7">top up
                                            </option>

                                        </select>
                                    </div>
                                    <div class="input-group col-lg-3">
                                        <span class="input-group-addon">目标学历</span>
                                        <!--<input type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1">-->
                                        <select type="text" class="form-control" aria-describedby="basic-addon1"
                                                name="educationSection" id="educationSection">
                                            <option value="0">请选择</option>
                                            <option th:selected="${commissionSchool!=null}? ${commissionSchool.educationSection==2}"
                                                    value="2">中小学
                                            </option>
                                            <option th:selected="${commissionSchool!=null}? ${commissionSchool.educationSection==3}"
                                                    value="3">本科
                                            </option>
                                            <option th:selected="${commissionSchool!=null}? ${commissionSchool.educationSection==4}"
                                                    value="4">硕士
                                            </option>
                                            <option th:selected="${commissionSchool!=null}? ${commissionSchool.educationSection==5}"
                                                    value="5">博士
                                            </option>
                                            <option th:selected="${commissionSchool!=null}? ${commissionSchool.educationSection==9}"
                                                    value="9">专科
                                            </option>
                                            <option th:selected="${commissionSchool!=null}? ${commissionSchool.educationSection==10}"
                                                    value="10">非学历
                                            </option>
                                            <option th:selected="${commissionSchool!=null}? ${commissionSchool.educationSection==11}"
                                                    value="11">证书
                                            </option>
                                            <option th:selected="${commissionSchool!=null}? ${commissionSchool.educationSection==12}"
                                                    value="12">副学士
                                            </option>
                                        </select>
                                    </div>
                                </div>
                                <div class="input-group col-lg-6" id="testID">
                                    <span class="input-group-addon">学校名称</span>
                                    <input id="collegeId" th:value="${commissionSchool.schoolName}" type="text"
                                           style="display: none"/>
                                    <select class="col-sm-1 chosen-select" name="collegeId" id="college"
                                            onchange="commissionSchoolId()"
                                            data-placeholder="Choose a Country..." style="width:542px">
                                        <option value="-1">请选择</option>
                                        <option th:each="item: ${school}" th:value="${item.id}"
                                                th:text="${item.englishName}"
                                                th:selected="${commissionSchool.collegeId == item.id+''}"></option>
                                    </select>
                                </div>

                                <div class="input-group col-lg-6" id="agencyNos">
                                    <span class="input-group-addon">合作机构</span>
                                    <input id="agencyNosId" th:value="${commissionSchool.agencyName}" type="text"
                                           style="display: none"/>
                                    <select class="col-sm-1 chosen-select" name="agencyNo" id="agencyNo"
                                            onchange="agencyId()"
                                            data-placeholder="Choose a School..." style="width:542px">
                                        <option value="-2">请选择</option>
                                        <option th:each="item:${cooperations}"
                                                th:selected="${commissionSchool.agencyNo eq item.id}"
                                                th:value="${item.id}"
                                                th:text="${item.name}">
                                        </option>
                                    </select>
                                </div>

                                <div class="input-group col-lg-6">
                                    <span class="input-group-addon">专业名称</span>
                                    <input id="majorId" th:value="${commissionSchool.majorName}" type="text"
                                           style="display: none"/>
                                    <select class="col-sm-1 chosen-select" name="majorId" id="majorIdNew"
                                            data-placeholder="Choose a Country..." style="width:542px;">
                                        <option value="-1">请选择</option>
                                        <option th:each="item: ${listMajor}" th:value="${item.id}"
                                                th:text="${item.englishName}"
                                                th:selected="${commissionSchool.majorId == item.id+''}"></option>
                                    </select>
                                </div>
                                <div class="input-group col-lg-6">
                                    <span class="input-group-addon">学位名称</span>
                                    <input id="courseId" th:value="${commissionSchool.courseName}" type="text"
                                           style="display: none"/>
                                    <select class="col-sm-1 chosen-select" name="courseId" id="courseIdNew"
                                            data-placeholder="Choose a Country..." style="width:542px;">
                                        <option value="-1">请选择</option>
                                        <option th:each="item: ${listCourse}" th:value="${item.id}"
                                                th:text="${item.englishName}"
                                                th:selected="${commissionSchool.courseId == item.id}"></option>
                                    </select>
                                </div>
                                <div class="input-group col-lg-6">
                                    <span class="input-group-addon">上课校区</span>
                                    <input type="text" class="form-control" placeholder=" "
                                           aria-describedby="basic-addon1" id="schoolArea" name="schoolArea"
                                           th:value="${commissionSchool!=null}? ${commissionSchool.schoolArea}"/>
                                </div>
                                <div class="input-group col-lg-3">
                                    <span class="input-group-addon">Paid Fee</span>
                                    <input type="text" class="form-control" placeholder=" "
                                           aria-describedby="basic-addon1" id="paidFee" name="paidFee"
                                           th:value="${commissionSchool!=null}? ${commissionSchool.paidFee}"/>
                                </div>
                                <div class="input-group col-lg-3">
                                    <span class="input-group-addon">开课时间</span>
                                    <input class="form-control" placeholder=" " aria-describedby="basic-addon1"
                                           onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" th:name="startDate"
                                           id="startDate"
                                           th:value="${commissionSchool.startDate!=null}? ${#dates.format(commissionSchool.startDate,'yyyy-MM-dd')}"/>
                                </div>
                                <div class="input-group col-lg-3">
                                    <span class="input-group-addon">结课时间</span>
                                    <input class="form-control" placeholder=" " aria-describedby="basic-addon1"
                                           onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" th:name="endDate" id="endDate"
                                           th:value="${commissionSchool.endDate!=null}?${#dates.format(commissionSchool.endDate,'yyyy-MM-dd')}"/>
                                </div>
                                <div class="input-group col-lg-3">
                                    <span class="input-group-addon">学校学号</span>
                                    <input type="text" class="form-control" placeholder=" "
                                           aria-describedby="basic-addon1" id="schoolNo" name="schoolNo"
                                           th:value="${commissionSchool!=null}? ${commissionSchool.schoolNo}"/>
                                </div>
                                <div class="input-group col-lg-3">
                                    <span class="input-group-addon">课程周数</span>
                                    <input type="text" class="form-control" placeholder=" "
                                           aria-describedby="basic-addon1" id="studyWeek" name="studyWeek"
                                           th:value="${commissionSchool!=null}? ${commissionSchool.studyWeek}"/>
                                </div>
                                <div class="input-group col-lg-3">
                                    <span class="input-group-addon">学费金额</span>
                                    <input type="number" class="form-control" placeholder=" "
                                           aria-describedby="basic-addon1" id="tuition" name="tuition"
                                           th:value="${commissionSchool!=null}? ${commissionSchool.tuition}"/>
                                </div>
                                <div class="input-group col-lg-3">
                                    <span class="input-group-addon">学生属性</span>
                                    <select type="text" class="form-control" aria-describedby="basic-addon1"
                                            name="studentProperty" id="studentProperty">
                                        <option value="0">请选择</option>
                                        <option value="1"
                                                th:selected="${commissionSchool!=null}? ${commissionSchool.studentProperty == '1'}">
                                            转中介
                                        </option>
                                        <option value="2"
                                                th:selected="${commissionSchool!=null}? ${commissionSchool.studentProperty == '2'}">
                                            打包课程
                                        </option>
                                    </select>
                                </div>

                                <div class="input-group col-lg-12">
                                    <span class="input-group-addon">课程属性</span>
                                    <p type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1">
                                        <label>
                                            <input type="checkbox" id="courseProperty1" name="checkchild" value="1"/>
                                            新学位
                                        </label>
                                        <label>
                                            <input type="checkbox" id="courseProperty2" name="checkchild" value="2"/> 转学
                                        </label>
                                        <label>
                                            <input type="checkbox" id="courseProperty3" name="checkchild" value="3"/>
                                            转专业
                                        </label>
                                        <label>
                                            <input type="checkbox" id="courseProperty4" name="checkchild" value="4"/>
                                            转课程
                                        </label>
                                        <label>
                                            <input type="checkbox" id="courseProperty5" name="checkchild" value="5"/>
                                            加读语言
                                        </label>
                                        <label>
                                            <input type="checkbox" id="courseProperty6" name="checkchild" value="6"/> 填缝
                                        </label>
                                        <label>
                                            <input type="checkbox" id="courseProperty7" name="checkchild" value="7"/> 延期
                                        </label>
                                        <label>
                                            <input type="checkbox" id="courseProperty8" name="checkchild" value="8"/>
                                            原打包
                                        </label>
                                        <label>
                                            <input type="checkbox" id="courseProperty9" name="checkchild" value="9"/> 补课
                                        </label>
                                    </p>
                                </div>
                                <div class="input-group col-lg-3">
                                    <span class="input-group-addon">结佣归属</span>
                                    <!--<input type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1">-->
                                    <select type="text" class="form-control" aria-describedby="basic-addon1"
                                            name="commissionBelong" id="commissionBelong">
                                        <option value="0" selected="selected">请选择</option>
                                        <option value="1"
                                                th:selected="${commissionSchool!=null}? ${commissionSchool.commissionBelong == '1'}">
                                            AEA
                                        </option>
                                        <option value="2"
                                                th:selected="${commissionSchool!=null}? ${commissionSchool.commissionBelong == '2'}">
                                            ECIE
                                        </option>
                                        <option value="3"
                                                th:selected="${commissionSchool!=null}? ${commissionSchool.commissionBelong == '3'}">
                                            BAEC
                                        </option>
                                    </select>
                                </div>
                                <div class="input-group col-lg-3">
                                    <span class="input-group-addon">佣金比例</span>
                                    <input type="number" class="form-control" placeholder=" "
                                           aria-describedby="basic-addon1" id="schoolRate" name="schoolRate"
                                           th:value="${commissionSchool!=null}? ${commissionSchool.schoolRate}"/>
                                </div>

                                <div class="input-group col-lg-3">
                                    <span class="input-group-addon">佣金币种</span>
                                    <!--<input type="text" class="form-control" placeholder=" " aria-describedby="basic-addon1">-->
                                    <select type="text" class="form-control" aria-describedby="basic-addon1"
                                            name="commissionCurrency" id="commissionCurrency">
                                        <option value="0">请选择</option>
                                        <option th:each="item: ${currencyInfos}" th:value="${item.id}"
                                                th:text="${item.enName}"
                                                th:selected="${commissionSchool.commissionCurrency != null} ? ${commissionSchool.commissionCurrency == item.id+''}"></option>
                                    </select>
                                </div>
                                <div class="input-group col-lg-3">
                                    <span class="input-group-addon">文签顾问</span>
                                    <input type="text" class="form-control" placeholder=" "
                                           aria-describedby="basic-addon1" id="copyOperator" name="copyOperator"
                                           th:value="${commissionSchool.copyOperator != null} ? ${commissionSchool.copyOperator}"/>
                                </div>

                                <div class="input-group col-lg-3">
                                    <span class="input-group-addon">学费币种</span>
                                    <select type="text" class="form-control" aria-describedby="basic-addon1"
                                            id="tuitionCurrency" name="tuitionCurrency">
                                        <option value="0">请选择</option>
                                        <option th:each="item: ${currencyInfos}" th:value="${item.id}"
                                                th:text="${item.enName}"
                                                th:selected="${commissionSchool.tuitionCurrency != null} ? ${commissionSchool.tuitionCurrency == item.id+''}"></option>
                                    </select>
                                </div>
                                <div class="input-group col-lg-3">
                                    <span class="input-group-addon">结佣状态</span>
                                    <select type="text" class="form-control" aria-describedby="basic-addon1"
                                            name="status" id="status">
                                        <option value="0">请选择</option>
                                        <option value="1"
                                                th:selected="${commissionSchool!=null}? ${commissionSchool.status =='1'}">
                                            未开始
                                        </option>
                                        <option value="2"
                                                th:selected="${commissionSchool!=null}? ${commissionSchool.status =='2'}">
                                            进行中
                                        </option>
                                        <option value="3"
                                                th:selected="${commissionSchool!=null}? ${commissionSchool.status =='3'}">
                                            已结束
                                        </option>
                                    </select>
                                </div>

                                <div class="input-group col-lg-3">
                                    <span class="input-group-addon">已付学费币种</span>
                                    <select type="text" class="form-control" aria-describedby="basic-addon1"
                                            id="paidTuitionCurrency" name="paidTuitionCurrency">
                                        <option value="0">请选择</option>
                                        <option th:each="item: ${currencyInfos}" th:value="${item.id}"
                                                th:text="${item.enName}"
                                                th:selected="${commissionSchool.paidTuitionCurrency != null} ? ${commissionSchool.paidTuitionCurrency == item.id+''}"></option>
                                    </select>
                                </div>


                                <div class="input-group col-lg-3">
                                    <span class="input-group-addon">顾问分支</span>
                                    <select type="text" class="form-control" aria-describedby="basic-addon1"
                                            name="consulterBranch" id="consulterBranch" onchange="selectTest(this,1)">
                                        <option value="0">请选择</option>
                                        <option th:each="item: ${advisers}" th:value="${item.seriano}"
                                                th:text="${item.branchName}"
                                                th:selected="${commissionSchool.consulterBranch != null} ? ${commissionSchool.consulterBranch == item.seriano+''}"></option>
                                    </select>
                                </div>
                                <div class="input-group col-lg-3">
                                    <span class="input-group-addon">顾问</span>
                                    <input type="text" class="form-control" placeholder=" "
                                           aria-describedby="basic-addon1" id="consulter" name="consulter"
                                           th:value="${commissionSchool.consulter != null} ? ${commissionSchool.consulter}"/>
                                </div>
                                <div class="input-group col-lg-3">
                                    <span class="input-group-addon">转接顾问</span>
                                    <input type="text" class="form-control" placeholder=" "
                                           aria-describedby="basic-addon1" id="transferConsulter"
                                           name="transferConsulter"
                                           th:value="${commissionSchool.transferConsulter != null} ? ${commissionSchool.transferConsulter}"/>
                                </div>
                                <div class="input-group col-lg-12">
                                    <span class="input-group-addon">学生备注</span>
                                    <input type="text" class="form-control" placeholder=" "
                                           aria-describedby="basic-addon1" id="schoolRemark2" name="schoolRemark2"
                                           th:value="${commissionSchool.schoolRemark2 != null} ? ${commissionSchool.schoolRemark2}"
                                           disabled="disabled"/>
                                </div>
                                <div class="input-group col-lg-12">
                                    <span class="input-group-addon">课程备注</span>
                                    <input type="text" class="form-control" placeholder=" "
                                           aria-describedby="basic-addon1" id="courseRemark" name="courseRemark"
                                           th:value="${commissionSchool.courseRemark != null} ? ${commissionSchool.courseRemark}"/>
                                </div>


                                <div class="form-inline" style="line-height:38px">
                                    <div class="col-sm-12">
                                        <label class="col-sm-2 control-label no-padding-left"><span style="color: red">&nbsp;&nbsp;</span>OfferFile:</label>
                                        <div class="clearfix">
                                            <div class="col-sm-8" style="line-height:38px">
                                                <div class="error">请选择图片上传，支持格式为(jpg,
                                                    png,gif,jpeg,pdf,doc,docx,eml)，图片最大2M
                                                </div>
                                                <input id="exampleInputFileOffer" name="fileInput" type="file"
                                                       style="height: 200px"
                                                       multiple="multiple"/>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-inline" style="line-height:38px">
                                    <div class="col-sm-12">
                                        <label class="col-sm-2 control-label no-padding-left"><span style="color: red">&nbsp;&nbsp;</span>COEFile:</label>
                                        <div class="clearfix">
                                            <div class="col-sm-8" style="line-height:38px">
                                                <div class="error">请选择图片上传，支持格式为(jpg,
                                                    png,gif,jpeg,pdf,doc,docx,eml)，图片最大2M
                                                </div>
                                                <input id="exampleInputFileCoe" name="fileInput" type="file"
                                                       style="height: 200px"
                                                       multiple="multiple"/>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-inline" style="line-height:38px">
                                    <div class="col-sm-12">
                                        <label class="col-sm-2 control-label no-padding-left"><span style="color: red">&nbsp;&nbsp;</span>EmailFile:</label>
                                        <div class="clearfix">
                                            <div class="col-sm-8" style="line-height:38px">
                                                <div class="error">请选择图片上传，支持格式为(jpg,
                                                    png,gif,jpeg,pdf,doc,docx,eml)，图片最大2M
                                                </div>
                                                <input id="exampleInputFileEmail" name="fileInput" type="file"
                                                       style="height: 200px"
                                                       multiple="multiple"/>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                            </div>
                        </li>
                    </ul>

                    <conter>
                        <button type="button" class="btn btn-primary" style="left: 50%" id="submits">保存</button>
                        <button type="button" class="btn btn-default" style="left: 50%" id="calback">取消</button>
                    </conter>
                </div>
            </form>
            <div th:include="fragments/bottom::bottom"></div>
        </div>
    </div>
    <a href="#" id="btn-scroll-up"
       class="btn-scroll-up btn btn-sm btn-inverse"> <i
            class="icon-double-angle-up icon-only bigger-110"></i>
    </a>
</div>
<!-- /.main-container -->

<!-- Modal备注 -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content"></div>
    </div>
</div>
<div th:include="fragments/js::js"></div>
<script th:src="@{/assets/js/chosen.jquery.min.js}"></script>
<script th:src="@{/My97DatePicker/WdatePicker.js}"></script>
<script th:src="@{/assets/js/jquery.inputlimiter.1.3.1.min.js}"></script>
<script th:src="@{/assets/js/jquery.maskedinput.min.js}"></script>
<script th:src="@{/assets/js/bootstrap-tag.min.js}"></script>
<script th:src="@{/assets/js/ace-elements.min.js}"></script>
<script th:src="@{/business/invoice/commissionCooperation.js}"></script>
<!--<script th:src="@{/assets/js/ace.min.js}"></script>-->
<script th:src="@{/assets/js/jquery.form.js}"></script>
<script th:src="@{/business/common.js}"></script>
<script th:src="@{/assets/js/jquery.validate.min.js}"></script>
<script th:src="@{/assets/js/jquery.validate.zh-CN.js}"></script>
<!-- page specific plugin scripts -->
<script th:src="@{/assets/js/jquery.dataTables.min.js}"></script>
<!--<script th:src="@{/js/bootstrap.js}"></script>-->
<script th:src="@{/business/commission/commissionBranch.js}"></script>
<script th:src="@{/assets/js/jquery.dataTables.bootstrap.js}"></script>
<script th:src="@{/assets/js/temp.js}" charset="UTF-8"></script>
<script th:src="@{/business/user/user.js}" charset="UTF-8"></script>
<!--图片查看器-->
<script th:src="@{/assets/fileinput/js/fileinput.js}"></script>
<script th:src="@{/assets/fileinput/js/fileinput_geturlTyep.js}"></script>
<script th:src="@{/assets/fileinput/themes/explorer/theme.js}"></script>
<script th:src="@{/assets/fileinput/js/locales/zh.js}"></script>
<script th:src="@{/assets/js/jquery.colorbox-min.js}"></script>
<script th:src="@{/layer/layer.js}"></script>
<script type="text/javascript" th:inline="javascript">
    /*<![CDATA[*/
    var courseProperty = [[${commissionSchool.courseProperty}]];
    if (courseProperty != null && courseProperty != "") {
        var arr = courseProperty.split(",");
        for (var i = 0; i <= arr.length; i++) {
            var j = arr[i];
            $("#courseProperty" + j).attr("checked", true);
        }
    }

    createFile($('#exampleInputFileOffer'), $("#offerFile"));
    createFile($('#exampleInputFileCoe'), $("#coeFile"));
    createFile($('#exampleInputFileEmail'), $("#emailFile"));

    jQuery(function ($) {
        var input_collegeName = "";
        var input_courseName = "";
        var input_majorName = "";
        $("#schoolName").val($("#collegeId").val())
        $("#courseName").val($("#courseId").val())
        $("#majorName").val($("#majorId").val())

        var pageHelper = (function () {
            this.studentNo;
            this.uploadComplete;
            this.postData = function () {

                if ($("#college").val() == -1) {
                    layer.alert("请填写院校名称", {icon: 0});
                    $("#submits").removeAttr("disabled");
                    return;
                }

                if ($("#majorIdNew").val() == "" || $("#majorIdNew").val() == '-1') {
                    $("#majorName").val("");
                }
                if ($("#courseIdNew").val() == "" || $("#courseIdNew").val() == '-1') {
                    $("#courseName").val("");
                }

                if ($("#agencyNo").val() == "" || $("#agencyNo").val() == '-2') {
                    layer.alert('请填写合作机构！', {icon: 0});
                    $("#submits").removeAttr("disabled");
                    return;
                }

                $.ajax({
                    url: "/commissionManage/editSchool?schoolId=" + $("#schoolId").val(),
                    type: "post",
                    data: $("#edit").serialize(),
                    success: function (data) {
                        console.log(data);
                        if (data) {
                            layer.confirm('操作成功，是否跳转到列表页？', {
                                icon: 1,
                                btn: ['确定'], //按钮
                                btn1: function () {
                                    $("#submits").removeAttr("disabled");
                                    location.href = '/commissionManage/edit?studentId=' + $("#studentId").val();
                                }
                            });
                        } else {
                            $("#submits").removeAttr("disabled");
                            layer.msg("操作失败", {time: 1000})
                        }
                    }
                });
            }
            $('#id-input-file-4').ace_file_input({
                style: 'well',
                btn_choose: 'Drop files here or click to choose',
                btn_change: null,
                no_icon: 'icon-cloud-upload',
                droppable: true,
                thumbnail: 'small',//large | fit
                before_change: function (files, dropped) {
                    return true;
                },
                before_remove: function () {
                    return true;
                },
                preview_error: function (filename, error_code) {
                }
            }).on('change', function () {

            });


            return {
                init: function () {
                    this.getQueryData();
                    this.handelQueryData();
                    this.render();
                    this.addEvent();
                },
                getQueryData: function () {
                    this.studentNo = GetQueryString("studentNo");
                    this.uploadComplete = true;
                },
                handelQueryData: function () {

                },
                render: function () {
                    var _self = this;
                    $(".chosen-select").chosen();
                    $("div[flag='template']").hide();
                    if ($("#input_isAmerica").val() == "1") {
                        /* 学生留学国家为美国时显示登记完成日期,EVUS附件 */
                        $("#div_evus").show();
                        $("#form_file").show();
                    }
                },
                addEvent: function () {
                    var _self = this;

                    var studentNationName = $("#input_studentNationName").val();
                    $("select[name $='collegeId']").change(function () {
                        var schoolID = $(this).children("option:selected").val();
                        var index = $("select[name $='collegeId']").index($(this));
                        var select_course = $("select[name $='courseId']").eq(index);
                        var select_major = $("select[name $='majorId']").eq(index);
                        if (schoolID == "-1") {
                            select_course.empty().append($("<option value='-1'>请选择</option>"));
                            select_major.empty().append($("<option value='-1'>请选择</option>"));
                            select_course.trigger("chosen:updated");
                            select_major.trigger("chosen:updated");
                            return;
                        }
                        var input_collegeName = $("input[name $='schoolName']").eq(index);
                        input_collegeName.val($(this).children("option:selected").text());
                        $("#collegeId").val($(this).children("option:selected").val());
                        $("#schoolName").val($(this).children("option:selected").text());
                        var courseType = $("select[name $='collegeType']").eq(index).children("option:selected").val();
                        var educationSection = $("select[name $='educationSection']").eq(index).children("option:selected").val();
                        var college = $("select[name $='college']").eq(index).children("option:selected").val();
                        var majorType;
                        switch (courseType) {
                            case "1":
                                majorType = 1;
                                break;
                            case "2":
                                majorType = 2;
                                break;
                            case "3":
                                majorType = 3;
                                break;
                            case "4":
                                majorType = 4;
                                break;
                            case "5":
                                majorType = 5;
                                break;
                            case "6":
                                majorType = 6;
                                break;
                            case "7":
                                majorType = 7;
                                break;

                        }
                        console.log("collegeId:" + $(this).children("option:selected").val());
                        console.log("collegeType:" + courseType);
                        console.log("majorType:" + educationSection);
                        if (educationSection != "" && educationSection != '0') {
                            if (collegeType != "" && collegeType != '0') {
                                if (college != "" && college != '-2') {
                                    $.post("/visaRecord/getMajor", {
                                        "schoolID": schoolID,
                                        "majorType": $("#collegeType").val(),
                                        "educationSection": educationSection
                                    }, function (data, status) {
                                        select_major.empty();
                                        select_course.empty();
                                        select_course.append($("<option value='-1'>请选择</option>"));
                                        select_major.append($("<option value='-1'>请选择</option>"));
                                        $.each(data, function (index, item) {
                                            select_major.append($("<option value=" + item.id + ">" + item.englishName + "</option>"));
                                        });
                                        $(".chosen-select").trigger("chosen:updated");
                                    });
                                }
                            }

                        }


                    });
                    $("select[name $='collegeType']").change(function () {
                        var index = $("select[name $='collegeType']").index($(this));
                        $("select[name $='collegeId']").eq(index).trigger("change");
                    });
                    $("select[name $='educationSection']").change(function () {
                        var index = $("select[name $='educationSection']").index($(this));
                        $("select[name $='collegeId']").eq(index).trigger("change");
                    });
                    $("select[name $='majorId']").change(function () {
                        var index = $("select[name $='majorId']").index($(this));
                        var schoolID = $("select[name $='collegeId']").eq(index).children("option:selected").val();
                        var majorID = $("select[name $='majorId']").eq(index).children("option:selected").val();
                        var select_course = $("select[name $='courseId']").eq(index);
                        if (majorID == "-1") {
                            select_course.empty().append($("<option value='-1'>请选择</option>"));
                            select_course.trigger("chosen:updated");
                            return;
                        }
                        var input_majorName = $("input[name $='majorName']").eq(index);
                        input_majorName.val($(this).children("option:selected").text());
                        console.log("majorId:" + $(this).children("option:selected").val());
                        console.log("majorName:" + $(this).children("option:selected").text());
                        $("#majorId").val($(this).children("option:selected").val());
                        $("#majorName").val($(this).children("option:selected").text());
                        $.post("/visaRecord/getCourse", {
                            "schoolID": schoolID,
                            "majorId": majorID
                        }, function (data, status) {
                            select_course.empty();
                            select_course.append($("<option value='-1'>请选择</option>"));
                            $.each(data, function (index, item) {
                                select_course.append($("<option value=" + item.id + ">" + item.englishName + "</option>"));
                            });
                            $(".chosen-select").trigger("chosen:updated");
                        });
                    });
                    $("select[name $='courseId']").change(function () {
                        var index = $("select[name $='courseId']").index($(this));
                        var input_courseName = $("input[name $='courseName']").eq(index);
                        input_courseName.val($(this).children("option:selected").text());
                        console.log("courseId:" + $(this).children("option:selected").val());
                        console.log("courseName:" + $(this).children("option:selected").text());
                    });
                    $("#submits").click(function () {
                        var number = '';
                        var arr = '';
                        $('input:checkbox[name=checkchild]:checked').each(function (k) {
                            if (k == 0) {
                                number = $(this).val();
                            } else {
                                number += ',' + $(this).val();
                            }
                            if (k == 0) {
                                arr = 1;
                            } else if (k > 0) {
                                arr = number.split(",").length;
                            } else {
                                arr = 0;
                            }
                        })
                        $("#courseProperty").val(number);

                        $(this).attr("disabled", "disabled");
                        postData()
                    });
                    $("#calback").click(function () {
                        location.href = "/commissionManage/edit?studentId=" + $("#studentId").val();
                    });
                    $("input[name $= 'tuition']").each(function () {
                        $(this).keyup(function () {
                            var reg = $(this).val().match(/\d+\.?\d{0,2}/);
                            var txt = '';
                            if (reg != null) {
                                txt = reg[0];
                            }
                            $(this).val(txt);
                        }).change(function () {
                            $(this).keyup();
                        });
                    });
                    $("#a_addCourse").click(function () {
                        $("div[flag='template']:hidden").eq(0).show();
                    });
                    $("button[flag = 'btn_delete']").each(function () {
                        var btn = $(this);
                        btn.click(function () {
                            btn.parent("div").parent("div").hide();
                        });
                    });
                }
            }
        })();
        pageHelper.init();
    });


    function agencyId() {
        if ($("#agencyNo").val() != -1) {
            $("#agencyNo").change(function () {
                $("#agency_no").val($("#agencyNo").find("option:selected").val());
                $("#agency_name").val($("#agencyNo").find("option:selected").text());
            });
            $("#agency_no").val($("#agencyNo").find("option:selected").val());
            $("#agency_name").val($("#agencyNo").find("option:selected").text());
            $(".chosen-select").trigger("chosen:updated");
        }
    }


    /*]]>*/
</script>
</body>
</html>
